<template>
  <div>
    <div style="width:100%;background-color: #FFFFFF;">
      <a-tabs @change="callback" size="small">
        <a-tab-pane key="1" tab="个人信息" forceRender>
          <basicOne @basicOneD="basicOneFun" rel="prefetch" ref="basicOne"></basicOne>
        </a-tab-pane>
        <a-tab-pane key="2" tab="出入所衔接及报到" v-if="personStageFun(2)" forceRender>
          <join rel="prefetch" ref="join"></join>
        </a-tab-pane>
        <a-tab-pane key="3" tab="监所信息" v-if="personStageFun(3)" forceRender>
          <Prison rel="prefetch" ref="Prison"></Prison>
        </a-tab-pane>
        <a-tab-pane key="4" tab="变更执行地" v-if="personStageFun(4)" forceRender>
          <removeAssgin rel="prefetch" ref="removeAssgin"></removeAssgin>
        </a-tab-pane>
        <a-tab-pane key="5" tab="异地管控" v-if="personStageFun(5)" forceRender>
          <allopatry rel="prefetch" ref="allopatry"></allopatry>
        </a-tab-pane>
        <a-tab-pane key="6" tab="请假" v-if="personStageFun(6)" forceRender>
          <leave rel="prefetch" ref="leave"></leave>
        </a-tab-pane>
        <a-tab-pane key="7" tab="终止" v-if="personStageFun(7)" forceRender>
          <discontinue rel="prefetch" ref="discontinue"></discontinue>
        </a-tab-pane>
      </a-tabs>
    </div>
  </div>

</template>

<script>
import basicOne from "@views/sjsk/holographicArchives/modules/basics/basicOne";
import removeAssgin from "@views/sjsk/holographicArchives/modules/basics/removeAssgin";
import join from "@views/sjsk/holographicArchives/modules/basics/join";
import Prison from "@views/sjsk/holographicArchives/modules/basics/Prison";
import allopatry from "@views/sjsk/holographicArchives/modules/basics/allopatry";
import leave from '@views/sjsk/holographicArchives/modules/basics/leave'
import discontinue from "@views/sjsk/holographicArchives/modules/basics/discontinue";
export default {
  name: "index",
  components:{basicOne,removeAssgin,join,Prison,allopatry,leave,discontinue},

  data(){
    return {
      innse:true,
      defaultActiveKey: '1',
      //基本信息反馈数据
      dasicTop:{}
    }
  },
  mounted() {
    this.callback('1')
    // console.log(5)
    // this.$refs.basicOne.refreshTable()
  },
  methods:{
    refreshTable(){
      // console.log('基本信息')
    },
    basicOneFun(val){
      // console.log(val)
      // console.log('中转1')
      this.$emit('basicFun',val)
    },
    personStageFun(val){
      // return this.$store.state.routeObjData === val
      // console.log(this.$store.state)
      // console.log(this.$store.state.holographicArchives.routeObjData)
      if(this.$store.state.holographicArchives.routeObjData){
        if(this.$store.state.holographicArchives.routeObjData.personStage === 1 || this.$store.state.holographicArchives.routeObjData.personStage === '1'){
          return val === 3;
        }
        if(this.$store.state.holographicArchives.routeObjData.personStage === 2 || this.$store.state.holographicArchives.routeObjData.personStage === '2'){
          return true
        }
        if(this.$store.state.holographicArchives.routeObjData.personStage === 3 || this.$store.state.holographicArchives.routeObjData.personStage === '3'){
          return val === 3;
        }
      } else {
        console.log('请检查VUEX数据')
        return true
      }
    },
    callback(key) {
      switch(key){
        case '1':
          this.$refs.basicOne.refreshTable()

          break
        case '2':
          this.$refs.join.refreshTable()

          break
        case '3':
          this.$refs.Prison.refreshTable()

          break
        case '4':
          this.$refs.removeAssgin.refreshTable()

          break
        case '5':
          this.$refs.allopatry.refreshTable()

          break
        case '6':
          this.$refs.leave.refreshTable()

          break
        case '7':
          this.$refs.discontinue.refreshTable()

          break
      }
    },
  }
}
</script>

<style scoped>

</style>